<?
// Object.php
// written by: David Fudge [ rkstar@mac.com ]
// created on: November 3, 2008
// last modified: November 3, 2008
//
// description:
// this is really basic and just allows us to create instantiate a customized object.
// this class is primarily for use with the SQLQuery and Form classes.

class Object
{
	// constructor
	public function __construct( $key=false, $value=false ) { if( $key ) { $this->add($key, $value); } }
	
	// add a variable to the object
	public function add( $key, $value="" )
	{
		// sanity
		if( is_object($key) ) { return; }
		// set the key variable equal to value
		if( !is_array($key) ) { $this->$key = $value; }
		else
		{
			// treat $key as an assoc and set each value in this object
			while( list($k,$v) = each($key) )
			{
				// check for an array here
				if( is_array($v) ) { $this->$k = new Object($v); }
				else { $this->$k = $v; }
			}
		}
	}
	// "set" is here only as an alias for backward compatibility
	public function set( $key, $value="" ) { return $this->add($key,$value); }
	
	// remove a variable from the objec
	public function remove( $key ) { unset($this->$key); }
}
?>